package com.ipan.builder.util;

import java.io.File;

/**
 * 文件工具类
 * 
 * @author iPan
 * @version 2013-12-1
 */
public class BdFileUtils extends org.apache.commons.io.FileUtils {

	public static File createFileByPath(String fileName) {
		String path = BdStringUtils.substringBeforeLast(fileName.replace("\\", "/"), "/");
		checkAndCreateDirectory(new File(path));
		return new File(fileName);
	}
	
	public static void checkAndCreateDirectory(File dir) {
		if (dir.exists()) {
			return ;
		}
		checkAndCreateDirectory(dir.getParentFile());
		dir.mkdir();
	}
	
	public static void main(String[] args) throws Exception {
	}
}
